#include <stdio.h>

int data[20000];

int binary_search(int d[], int s, int e, int q)
{
    int i;
    for (i = s; i < e; i++)
        if (d[i] == q)
            return i;
    return -1;
}

int main()
{
    int i, m, n, s, e, q;
    scanf("%d", &n);
    for (i = 0; i < n; i++)
        scanf("%d", data + i);
    scanf("%d", &m);
    for (i = 0; i < m; i++) {
        scanf("%d%d%d", &s, &e, &q);
        printf("%d\n", binary_search(data, s, e, q));
    }
    return 0;
}
